<template>
    <div class="main-menu" :class="{ 'hidden': isHidden }">
        <div class="menu-content">
            <router-link to="/drone" custom v-slot="{ navigate }">
                <CesiumButton type="primary" @click="navigate">
                    <el-icon size="16"><Aim /></el-icon>
                    <span v-show="!isHidden">模拟飞行</span>
                </CesiumButton>
            </router-link>

            <router-link to="/video" custom v-slot="{ navigate }">
                <CesiumButton type="primary" @click="navigate">
                    <el-icon size="16"><VideoPlay /></el-icon>
                    <span v-show="!isHidden">视频播放</span>
                </CesiumButton>
            </router-link>

            <router-link to="/fusion" custom v-slot="{ navigate }">
                <CesiumButton type="primary" @click="navigate">
                    <el-icon size="16"><Setting /></el-icon>
                    <span v-show="!isHidden">视频融合</span>
                </CesiumButton>
            </router-link>

            <router-link to="/sync" custom v-slot="{ navigate }">
                <CesiumButton type="primary" @click="navigate">
                    <el-icon size="16"><Setting /></el-icon>
                    <span v-show="!isHidden">同步地图</span>
                </CesiumButton>
            </router-link>

            <router-link to="/test" custom v-slot="{ navigate }">
                <CesiumButton type="primary" @click="navigate">
                    <el-icon size="16"><Setting /></el-icon>
                    <span v-show="!isHidden">测试页面</span>
                </CesiumButton>
            </router-link>
        </div>

        <div class="toggle-button" @click="toggleMenu">
            <CesiumButton type="info" size="small">
                <el-icon size="16">
                    <DArrowRight v-if="isHidden"/>
                    <DArrowLeft v-else/>
                </el-icon>
            </CesiumButton>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { CesiumButton } from '@/components/cesium'
import { ElIcon } from 'element-plus'
import { Aim, Setting, DArrowRight, DArrowLeft, VideoPlay } from '@element-plus/icons-vue'

const isHidden = ref(true)

const toggleMenu = () => {
    isHidden.value = !isHidden.value
}
</script>

<style scoped lang="scss">
.main-menu {
    position: fixed;
    top: 25%;
    transform: translateY(-50%);
    left: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px 10px;
    z-index: 1000;
    transition: transform 0.3s ease;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);

    &.hidden {
        transform: translate(-100%, -50%);

        .toggle-button {
            position: absolute;
            right: -32px;
        }

        .menu-content {
            opacity: 0;
        }
    }

    .menu-content {
        transition: opacity 0.3s ease;
        display: flex;
        flex-direction: column;
        gap: 10px;

        :deep(.cesium-button) {
            display: flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;

            .el-icon {
                margin-right: 4px;
            }
        }
    }

    .toggle-button {
        position: absolute;
        right: -33px;
        top: 50%;
        transform: translateY(-50%);
        transition: right 0.3s ease;

        :deep(.cesium-button) {
            padding: 6px 6px;
            min-width: auto;
            border-radius: 0 4px 4px 0;

            .el-icon {
                margin: 0;
            }
        }
    }
}
</style> 